﻿using $ext_safeprojectname$.usermodels;
using System;

namespace $ext_safeprojectname$
{
    /// <summary>
    /// 
    /// </summary>
    public class $ext_safeprojectname$Exception : Exception
    {
        /// <summary>
        /// 
        /// </summary>
        public int Code { get; set; } = 500;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="code"></param>
        public $ext_safeprojectname$Exception(string message, ExceptionCode code = ExceptionCode.ShowInfo) : base(message)
        {
            Code = (int)code;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="code"></param>
        public $ext_safeprojectname$Exception(string message, string code) : base(message)
        {
            int.TryParse(code, out var _code);
            Code = _code;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="innerException"></param>
        public $ext_safeprojectname$Exception(string message, Exception innerException) : base(message, innerException)
        {

        }

    }
    /// <summary>
    /// 异常分类
    /// </summary>
    public enum ExceptionCode
    {
        /// <summary>
        /// 提示性错误
        /// </summary>
        ShowInfo = 700,
        /// <summary>
        /// 输入错误
        /// </summary>
        ModelErr = 400,
        /// <summary>
        /// 未登录或者密钥错误
        /// </summary>
        UnAuth=401,
        /// <summary>
        /// 没有权限
        /// </summary>
        UnRole=403
    }

    /// <summary>
    /// 查找用户条件
    /// </summary>
    public class InputSearchUser
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int page { get; set; } = 1;

        /// <summary>
        /// 页大小
        /// </summary>
        public int size { get; set; } = 20;

        /// <summary>
        /// 部门ID 组别ID
        /// </summary>
        public int partid { get; set; } = 0;
        /// <summary>
        /// 角色名称
        /// </summary>
        public string grade { get; set; } = "";
        /// <summary>
        /// 哪一个项目的
        /// </summary>
        public int projectid { get; set; }

        /// <summary>
        /// 哪一个任务的，可能projectid没法提供！
        /// </summary>
        public int orderid { get; set; }
    }

    /// <summary>
    /// 查询用户列表，是否绑定某一个对象
    /// </summary>
    public class InputUserBind
    {
        /// <summary>
        /// 一级条件
        /// </summary>
        public int projectid { get; set; }

        /// <summary>
        /// 二级条件 一级条件为0表示二级条件为绑定对象条件
        /// </summary>
        public int partid { get; set; }

        /// <summary>
        /// 关键字搜索
        /// </summary>
        public string word { get; set; }
    }





    /// <summary>
    /// 报表请求条件
    /// </summary>
    public class InputSearchReport
    {
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? datestart { get; set; } = null;

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? dateend { get; set; } = null;

        /// <summary>
        /// 某一个用户的
        /// </summary>
        public int userid { get; set; } = 0;

        /// <summary>
        /// 某一个项目的
        /// </summary>
        public int projectid { get; set; } = 0;
    }
}
